﻿using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using HR60_PanelSoft.FileUtils;
using HR60_PanelSoft.Model.BaseModel;

namespace HR60_PanelSoft.Model
{

    //GC: [g1] 加载bug [Proj]
    //GC: [g2] 加载后填充bug[Proj]
    /// <summary>
    /// 项目
    /// </summary>
	public class Proj
    {
		/// <summary>
		/// 当前项目
		/// </summary>
		public static Proj currentProj = null;

		/// <summary>
		/// 名称
		/// </summary>
		public string name;
		
		/// <summary>
		/// 地址
		/// </summary>
		public string addr;

        
        /* [g1.s1] 修改date的类型为string */
		/// <summary>
		/// 修改日期
		/// </summary>
		//public DateTime date;
        public string date;
        /* end of [g1.s1] */

		/// <summary>
		/// 作者
		/// </summary>
		public string writer;

		/// <summary>
		/// 默认样式
		/// </summary>
		public UIStyle defaultStyle;

		/// <summary>
		/// 下辖网络信息列表
		/// </summary>
		public List<Net> nets = new List<Net>();

		/// <summary>
		/// 下辖设备分组列表
		/// </summary>
		public List<DeviceGroup> deviceGroups = new List<DeviceGroup>();

		/// <summary>
		/// 场景列表
		/// </summary>
		public List<Scene> scenes = new List<Scene> ();


        /* [g2.s1] */
		/// <summary>
		/// 从文件读取
		/// </summary>
		/// <param name="filePath"></param>
		public static void load(string filePath)
		{
			Proj.currentProj = JsonFileUtils.loadProj (new Proj(), filePath);

		}

        /* end of [g2.s1] */

		/// <summary>
		/// 保存到文件
		/// </summary>
		/// <param name="filePath"></param>
		public void save(string filePath)
		{
			JsonFileUtils.saveProj (this, filePath);
		}

    }
}
